{% extends 'base.html' %}
{% block title %}区块查询{% endblock %}
{% block head %}
<title>TimeBank</title>
<link rel="bookmark"  type="image/x-icon"  href="{{url_for('static', filename='hIcon.jpg')}}"/>
<link rel="shortcut icon" href="{{url_for('static', filename='images/hIcon.jpg')}}">

<link rel="icon" href="{{url_for('static', filename='images/hIcon.jpg')}}">
{% endblock %}
{% block main %}
    <div class="container pt-100">
        <div style="padding:20px">
                <h1 style="padding-bottom:10px">区块信息</h1>
                <div class="row">
                    <div class="col-md-6 col-sm-6">
                        <table class="table table-striped">
                            <tr>
                                <th colspan="2">概览</th>
                            </tr>
                            <tr>
                                <td>版本</td>
                                <td>{{block.version}}</td>
                            </tr>
                            <tr>
                                <td>高度</td>
                                <td>
                                    {{block.height}}<font color="green">(主链)</font>
                                </td>
                            </tr>
                            <tr>
                                <td>时间</td>
                                <td>{{getTimeFromtimeStamp(block.timestamp)}}</td>
                            </tr>
                            <tr>
                                    <td>时间戳</td>
                                    <td>{{block.timestamp}}</td>
                             </tr>
                            
                        </table>
                    </div>
            
                    <div class="col-md-6 col-sm-6">
                        <table class="table table-striped">
                            <tr>
                                <th colspan="2">哈希值</th>
                            </tr>
                            <tr>
                                <td>哈希值</td>
                                <td>{{block.selfhash}}</a>
                                </td>
                            </tr>
                            <tr>
                               
                                <td>上一区块</td>
                                {% if block.height == 0 %}
                                    <td>这是创世区块</td>
                                {% elif  block.height == 1 %}
                                     <td>这是的第一个区块</td>
                                {% else %}
                                    <td><a class="hash-link" href="{{url_for("blockquery",blockhash= block.prevBlockHash)}}">{{block.prevBlockHash}}</a></td>
                                {% endif %}
                                
                            </tr>
                            <tr>
                                    <td>下一区块</td>
                                        
                                    <td>
                                        {% set nextBlkHash = getNextBlockHash(block.height+1,block.selfhash) %}
                                        {% if nextBlkHash == " " %}
                                            这是最顶端区块<br />
                                        {% else %}
                                            <a class="hash-link" href="{{url_for("blockquery",blockhash= nextBlkHash)}}">{{nextBlkHash}}</a><br />
                                        {% endif %}
                                        
                                    </td>
                            </tr>
                        </table>
                        <div class="center flex-center flex-justify">
                        </div>
                    </div>
            
                </div>
                
                <div style="width:100%; clear:both;">
                    <h2>交易记录</h2>
                    {% for  tx in block.transactions %}
                       
                        <div id="tx-350702621" class="txdiv">
                            <table class="table table-striped" cellpadding="0" cellspacing="0" style="padding:0px;float:left;margin:0px;width:100%">
                                <tr>
                                    <th colspan="3" align="left">
                                        <!--
                                        <a class="hash-link" href="/tx/d27317315add147d034aada69ae33c8163e179a8a0bff5a6629a08ef1cb1a06a">{{tx.selfhash}}</a> <span class="pull-right">{{getTimeFromtimeStamp(tx.timestamp)}}</span>
                                        -->
                                        交易{{loop.index}}:{{tx.selfhash}}<span class="pull-right">{{getTimeFromtimeStamp(tx.timestamp)}}</span>
                                        
                                    </th>
                                </tr>
                                <tr>
                                    
                                    <td class="txtd hidden-phone mobile-f12 stack-mobile">
                                       {% for vin in tx.txins %}
                                        <!--
                                         <a href="/address/1LMsiV4BW5XyRddDtcrq8jLbqxDwM2LoWk">{{vin}}</a><br />
                                        -->
                                            {% if vin.prevout.outindex ==-1 %}
                                                输入{{loop.index}}:<br />
                                                生成区块的奖励交易<br />
                                            {% else %}
                                                
                                                输入{{loop.index}}:<br />
                                                来源交易hash:{{vin.prevout.txhash}}<br />
                                                来源输出Index:{{vin.prevout.outindex}}<br />
                                            {% endif %}
                                        {% endfor %}
                                      
                                   
                                    </td>
                                    
                                    <td class="hidden-phone tx-arrow-col">
                                        <img src="{{url_for('static', filename='images/arrow_right_green.png')}}" />
                                    </td>

                                    <td class="txtd mobile-f12 stack-mobile">
                                        {% for vout in tx.txouts %}
                                           <!--
                                                <a href="/address/18P28xSPZZbm5ARMoTqrfKWWRr2Bqm6KDi">{{vout}}</a> <span class="pull-right hidden-phone"><span data-c="56808681" data-time="1527376906000">$ {{vout.value}}</span></span><br />
                                           -->
                                           输出{{loop.index}}:<br/>
                                           接受地址:{{vout.scriptPubKey['scriptPubkey']}}<br/>
                                           金额:{{vout.value}}<br/><br/>
                                        {% endfor %}
                                    </td>
                                    
                                </tr>
                            </table>
                        <!--
                            <div style="padding-bottom:30px;width:100%;text-align:right;clear:both"> 
                                <button class="btn btn-success cb"><span data-c="58706194" data-time="1527376906000">$ {{sum}}</span>
                                </button>
                            </div>
                        </div>
                        -->
                  
                   {% endfor %} 
           
                </div>
            
        </div>
    </div> 
    
{% endblock %}